#pragma once

#include <afxmt.h>
#include "Singleton.h"

class CLogThread;

class CLogger
	: public CSingleton_Ptr<CLogger>
{
public:
	CLogger(void);
	~CLogger(void);

	void SetLogLevel( const CString& strLevel );

	void TraceLog( const char * pszFmt, ... );
	void DebugLog( const char * pszFmt, ... );
	void InfoLog( const char * pszFmt, ... );
	void WarnLog( const char * pszFmt, ... );
	void ErrorLog( const char * pszFmt, ... );
	void FatalLog( const char * pszFmt, ... );

private:
	bool InitLogger( void );
	void UninitLogger( void );

	bool BeginThread( void );
	void EndThread( void );

private:
	DWORD				m_dwThreadID;
	HANDLE				m_hThreadHandle;
};

/*
struct Locker
{
Locker( CSyncObject& lock )
: m_Lock(lock)
{
m_Lock.Lock();
}
~Locker( void )
{
m_Lock.Unlock();
}
private:
CSyncObject&	m_Lock;
};
CCriticalSection	m_Lock;
*/